﻿
using System;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using Abp.Application.Services.Dto;
using Abp.Extensions;
using KDS.Mes.Mes.Stations;

namespace KDS.Mes.Mes.Stations.EntityMapper.Stations
{

	/// <summary>
    /// 工位信息的数据配置文件
    /// </summary>
    public class StationCfg : EntityTypeConfiguration<Station>
    {
		/// <summary>
        ///  构造方法[默认链接字符串< see cref = "MesDbContext" /> ]
        /// </summary>
		public StationCfg ()
		{
		            ToTable("Station", MesConsts.SchemaName.Basic);
 
      //todo: 需要将以下文件注入到MesDbContext中

  //		public IDbSet<Station> Stations { get; set; }
   //		 modelBuilder.Configurations.Add(new StationCfg());




		    // Line - 关系映射
			HasRequired(a => a.Line).WithMany().HasForeignKey(c => c.LineId).WillCascadeOnDelete(true);


		    // 工位名称
			Property(a => a.StationName).HasMaxLength(20);
		    // 工位代码
			Property(a => a.StationCode).HasMaxLength(20);
		}
    }
}